 //循环判断是否打开100花币卡商品页面
  while (!text("华为花币卡（电子卡）200花币").findOne(10000)) {
    app.startActivity({
      action: "android.intent.action.VIEW",
      packageName: "com.vmall.client",
      data: 'vmall://com.vmall.client/productDetail?launchExtra=%7B%22params%22:%5B%7B%22key%22:%22prdId%22,%22value%22:%22474242936%22%7D,%7B%22key%22:%22skuCode%22,%22value%22:%223201070000302%22%7D%5D%7D'
      //data: 'vmall://com.vmall.client/productDetail?launchExtra=%7B%22params%22:%5B%7B%22key%22:%22prdId%22,%22value%22:%22474242936%22%7D,%7B%22key%22:%22skuCode%22,%22value%22:%223201070000305%22%7D%5D%7D'
    });
  }
  log("进入商品页面")
  while (1) {
    //循环判断是否在50花币卡商品页面 立刻购买
    if (text("华为花币卡（电子卡）200花币").findOne(500)) {
      click("立即购买")
      log("立即购买")
       var num = id("prd_number_tv").findOne()
      while (num.text() < 1) {
         id("increase").findOne().click()
        sleep(2000)
        num = id("prd_number_tv").findOne()

       }
      sleep(2000)
      click("确定")
      log("确定")
      sleep(5000)
    }
    //判断积分是否抵扣 提交订单
    if (textContains("使用1915积分").findOne(500) && text("180.85").findOne(500)) {
      click(800, 1700)
      log("提交订单")
      sleep(5000)
    }
    if(textContains("点击添加地址信息").findOne(500)){
       var adress= textContains("点击添加地址信息").findOne(2000)
       if(adress){
           adress.click()
           sleep(2000)
           input(0,"王先生")
           input(1,"15236522563")
           input(3,"星湖花园")
           break
       }
      }

    //判断积分是否抵扣 提交订单
    if (textContains("秒内完成支付").findOne(500)) {

      sleep(5000)
      break
    }

  }


  function 点击文字(文字) {
    sleep(1000);
    var 点击的文字 = text(文字).findOne(5000);
    if (点击的文字) {
        var x = 点击的文字.bounds().centerX();
        var y = 点击的文字.bounds().centerY();
        sleep(1000);
        click(x, y);
        console.log("已点击" + 文字);
    } else {
        console.log("未发现" + 文字);
    }

}